' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '   F i l e   n a m e :     W X M _ E N C O D E R _ 2 0 0 _ 1 2 _ a r m . t x t                           D a t e :   2 3   A P R   2 0 2 0 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '   M i c r o S t e p p e r   s t e p p e r     s t e p   f o r   r u n 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '   E n c o d e r   2 0 0   p p r 
 
 '   H A L   r e c o g n i z e   8 0 0   p p r 
 
 '   S t e p p e r   1 . 8   d e g r e e 
 
 '   S t e p   p e r   f u l l   t u r n   =   8 0 0   ( j u m p e r   o n   B ) 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 
 
 ' L o a d   P O C . j p g 
 
 S p e e d   9 
 
 
 
 B u t t o n     1   T e x t   " H O M E " 
 
 B u t t o n     1   C o l o r   S k y B l u e 
 
 B u t t o n     2   T e x t   " H o m i n g _ M 0 " 
 
 B u t t o n     2   C o l o r   S k y B l u e 
 
 B u t t o n     3   T e x t   " H o m i n g _ M 1 " 
 
 B u t t o n     3   C o l o r   S k y B l u e 
 
 B u t t o n     4   T e x t   " H o m i n g _ M 2   Z " 
 
 B u t t o n     4   C o l o r   S k y B l u e 
 
 B u t t o n     5   T e x t   " S C I U S C I A   M 0 " 
 
 B u t t o n     5   C o l o r   A q u a m a r i n e 
 
 B u t t o n     6   T e x t   " S C I U S C I A   M 1 " 
 
 B u t t o n     6   C o l o r   A q u a m a r i n e 
 
 B u t t o n     7   T e x t   " S C I U S C I A   M 2   Z " 
 
 B u t t o n     7   C o l o r   A q u a m a r i n e 
 
 
 
 B u t t o n     1 2   T e x t   " S c i u s c i a   t u n e " 
 
 B u t t o n     1 2   C o l o r   A q u a m a r i n e 
 
 
 
 
 
 B u t t o n   1 3   T e x t   " E n a b l e   M o t o r s " 
 
 B u t t o n   1 3   C o l o r   T a n 
 
 B u t t o n   1 4   T e x t   " D i s a b l e   M o t o r s " 
 
 B u t t o n   1 4   C o l o r   T a n 
 
 
 
 ' B u t t o n   1 5   T e x t   " U P D A T E   F I L E " 
 
 
 
 B u t t o n   1 6   T e x t   " C L O S E   A L L " 
 
 B u t t o n   1 6   C o l o r   R e d 
 
 
 
 G o s u b   D i s a b l e A l l B u t t o n s 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ M 0 
 
 V a r i a b l e   N u m e r i c   S l o t _ M 1 
 
 V a r i a b l e   N u m e r i c   S l o t _ M 2 
 
 V a r i a b l e   N u m e r i c   S l o t _ S e n s o r M 0 
 
 V a r i a b l e   N u m e r i c   S l o t _ S e n s o r M 1 
 
 V a r i a b l e   N u m e r i c   S l o t _ S e n s o r M 2 
 
 V a r i a b l e   N u m e r i c   S l o t _ C o u n t e r R e a d e r O u t M 0 
 
 V a r i a b l e   N u m e r i c   S l o t _ C o u n t e r R e a d e r R e s e t M 0 
 
 V a r i a b l e   N u m e r i c   S l o t _ C o u n t e r R e a d e r O u t M 1 
 
 V a r i a b l e   N u m e r i c   S l o t _ C o u n t e r R e a d e r R e s e t M 1 
 
 V a r i a b l e   N u m e r i c   S l o t _ C o u n t e r R e a d e r O u t M 2 
 
 V a r i a b l e   N u m e r i c   S l o t _ C o u n t e r R e a d e r R e s e t M 2 
 
 V a r i a b l e   N u m e r i c   S l o t _ E n a b l e M o t o r s 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d R 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d G 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d B 
 
 
 
 
 
 
 
 S l o t _ M 0   =   1 
 
 S l o t _ M 1   =   3 
 
 S l o t _ M 2   =   5 
 
 
 
 S l o t _ S e n s o r M 0   =   1 9 
 
 S l o t _ S e n s o r M 1   =   2 0 
 
 S l o t _ S e n s o r M 2   =   2 1 
 
 
 
 S l o t _ C o u n t e r R e a d e r O u t M 0   =   2 6 
 
 S l o t _ C o u n t e r R e a d e r R e s e t M 0   =   2 5 
 
 
 
 S l o t _ C o u n t e r R e a d e r O u t M 1   =   2 8 
 
 S l o t _ C o u n t e r R e a d e r R e s e t M 1   =   2 7 
 
 
 
 S l o t _ C o u n t e r R e a d e r O u t M 2   =   3 0 
 
 S l o t _ C o u n t e r R e a d e r R e s e t M 2   =   2 9 
 
 
 
 S l o t _ E n a b l e M o t o r s   =   2 2 
 
 
 
 S l o t _ L e d R   =   1 6 
 
 S l o t _ L e d G   =   1 7 
 
 S l o t _ L e d B   =   1 8 
 
 
 
 V a r i a b l e   N u m e r i c   N u m T e s t 
 
 V a r i a b l e   N u m e r i c   N u m C y c l e s 
 
 V a r i a b l e   N u m e r i c   E r r o r N u m b e r 
 
 
 
 V a r i a b l e   S t r i n g   F i l e N a m e 
 
 V a r i a b l e   S t r i n g   F i l e H e a d e r 
 
 
 
 F i l e N a m e   =   " L o g _ E n c o d e r _ 0 _ 2 0 0 . t x t " 
 
 F i l e H e a d e r   =   " -   D A T E   -   "   +   "     -   T I M E   -   "   +   "     C Y C L E   "   +   "   D e s t . = 0   "   +   "   D e s t . = 5 0   "   +   +   "   P u l s e " 
 
 S a v e   S t r i n g T o F i l e   F i l e H e a d e r   F i l e N a m e 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L O A D   E X T E R N A L   P R O G R A M S 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ H A L . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ C o u n t e r R e a d e r 1 . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ C o u n t e r R e a d e r 2 . e x e " 
 
 ' L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ C o u n t e r R e a d e r 3 . e x e " 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T E S T   M A S T E R   P R E S E N T 
 
 F o r   v 1   =   1   T o   9 e 9 9 
 
 	 F o r   v 2   =   1   T o   2 0   '   < < <   t e s t i n g   f o r   2   s e c o n d s 
 
 	 	 I f   ( S l o t ( 0 )   > =   1   A n d   S l o t ( 0 )   < =   2 )   O r   K e y ( " C T R L " ) 
 
 	 	 	 E x i t   2 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 N e x t 
 
 	 P r i n t   "   I n v a l i d   m a s t e r   n u m b e r :   "   +   S l o t ( 0 ) 
 
 	 S l o t   0   =   R e c o g n i z e 
 
 	 B e e p 
 
 N e x t 
 
 P r i n t   " " 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   C O L O R 
 
 
 
 ' G o s u b   " W H I T E " 
 
 ' W a i t   S e c o n d s   0 . 1 
 
 ' G o s u b   " R E D " 
 
 ' W a i t   S e c o n d s   0 . 1 
 
 ' G o s u b   " G R E E N " 
 
 ' W a i t   S e c o n d s   0 . 1 
 
 ' G o s u b   " B L U " 
 
 ' W a i t   S e c o n d s   0 . 1 
 
 
 
 G o s u b   E n a b l e A l l B u t t o n s 
 
 
 
 S t o p 
 
 
 
 
 
 L a b e l   D i s a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   3 2 
 
 	 	 B u t t o n   v 1   D i s a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   E n a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   3 2 
 
 	 	 B u t t o n   v 1   E n a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     F U N C T I O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '   W e   w o r k   w i t h   8 0 0   s t e p s   p e r   t u r n 
 
 '   o n e   s t e p   =   0 . 0 0 1 2 5   o f   t u r n 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 V a r i a b l e   N u m e r i c   T o l e r a n c e 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t C o u n t e r R e a d e r O u t 
 
 V a r i a b l e   N u m e r i c   F i r s t P o s i t i o n 
 
 V a r i a b l e   N u m e r i c   S e c o n d P o s i t i o n 
 
 
 
 L a b e l   " S C I U S C I A   M 0 " 
 
 	 B u t t o n   5   C o l o r   F l a s h i n g 8   R e d   B l a c k 
 
 	 G o s u b   " H o m i n g _ M 0 " 
 
 	 ' 
 
 	 S l o t M o t o r     =   S l o t _ M 0 
 
 	 S l o t S e n s o r   =   S l o t _ S e n s o r M 0 
 
 	 S l o t C o u n t e r R e a d e r O u t   =   S l o t _ C o u n t e r R e a d e r O u t M 0 
 
 	 ' 
 
 	 F i r s t P o s i t i o n   =   2 7 0 
 
 	 S e c o n d P o s i t i o n   =   9 0 
 
 	 T o l e r a n c e   =   0 . 0 0 2 
 
 	 G o s u b   E x e c u t e S c i u s c i a 
 
 	 B u t t o n   5   C o l o r   A q u a m a r i n e 
 
 R e t u r n 
 
 
 
 L a b e l   " S C I U S C I A   M 1 " 
 
 	 B u t t o n   6   C o l o r   F l a s h i n g 8   R e d   B l a c k 
 
 	 G o s u b   " H o m i n g _ M 1 " 
 
 	 ' 
 
 	 S l o t M o t o r     =   S l o t _ M 1 
 
 	 S l o t S e n s o r   =   S l o t _ S e n s o r M 1 
 
 	 S l o t C o u n t e r R e a d e r O u t   =   S l o t _ C o u n t e r R e a d e r O u t M 1 
 
 	 ' 
 
 	 F i r s t P o s i t i o n   =   2 7 0 
 
 	 S e c o n d P o s i t i o n   =   9 0 
 
 	 T o l e r a n c e   =   0 . 0 1 
 
 	 G o s u b   E x e c u t e S c i u s c i a 
 
 	 B u t t o n   6   C o l o r   A q u a m a r i n e 
 
 R e t u r n 
 
 
 
 L a b e l   " S C I U S C I A   M 2   Z " 
 
 	 B u t t o n   7   C o l o r   F l a s h i n g 8   R e d   B l a c k 
 
 	 G o s u b   " H o m i n g _ M 2   Z " 
 
 	 ' 
 
 	 S l o t M o t o r     =   S l o t _ M 2 
 
 	 S l o t S e n s o r   =   S l o t _ S e n s o r M 2 
 
 	 S l o t C o u n t e r R e a d e r O u t   =   S l o t _ C o u n t e r R e a d e r O u t M 2 
 
 	 ' 
 
 	 F i r s t P o s i t i o n   =   1 7 0 
 
 	 S e c o n d P o s i t i o n   =   1 5 0 
 
 	 T o l e r a n c e   =   0 . 0 1 
 
 	 G o s u b   E x e c u t e S c i u s c i a 
 
 	 B u t t o n   7   C o l o r   A q u a m a r i n e 
 
 R e t u r n 
 
 
 
 L a b e l   E x e c u t e S c i u s c i a 
 
 	 ' N u m T e s t   =   I n p u t   " T e l l   m e   h o w   m a n y   c y c l e : " 
 
 	 N u m T e s t   =   3 0 0 0 0 0 
 
 	 G o s u b   " E n a b l e   M o t o r s " 
 
 	 F o r   v 1   =   1   T o   N u m T e s t 
 
 	 	 ' 
 
 	 	 S l o t ( S l o t M o t o r )   =   F i r s t P o s i t i o n 
 
 	 	 G o s u b   W a i t M o t o r A n d R e c o v e r y 
 
 	 	 W a i t   S e c o n d s   0 . 5 
 
 	 	 ' 
 
 	 	 S l o t ( S l o t M o t o r )   =   S e c o n d P o s i t i o n 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 	 W a i t   S e c o n d s   0 . 5 
 
 	 	 G o s u b   W a i t M o t o r A n d R e c o v e r y 
 
 	 	 W a i t   S e c o n d s   0 . 5 
 
 	 	 ' 
 
 	 	 I f   K e y ( " C T R L " ) 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   " E r r o r R e c o v e r y " 
 
 	 ' 
 
 	 ' s 1   =   M e s s a g e   " M I S A L I G N M E N T :   "   +   s 2 
 
 	 s 1   =   " Y E S " 
 
 	 I f   S 1   =   " Y E S " 
 
 	 	 ' G o s u b   " U P D A T E   F I L E " 
 
 	 	 ' 
 
 	 	 v 4   =   S l o t ( S l o t M o t o r ) 
 
 	 	 G o s u b   " D i s a b l e   M o t o r s " 
 
 	 	 S l o t ( S l o t M o t o r )   =   S l o t ( S l o t C o u n t e r R e a d e r O u t ) 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 	 G o s u b   " E n a b l e   M o t o r s " 
 
 	 	 S l o t ( S l o t M o t o r )   =   v 4 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 E l s e 
 
 	 	 E n d 
 
 	 E n d I f 
 
 	 
 
 	 s 2   =   S l o t ( S l o t M o t o r )   -   S l o t ( S l o t C o u n t e r R e a d e r O u t ) 
 
 	 P r i n t   " E R R O R : "   +   s 2 
 
 R e t u r n 
 
 
 
 L a b e l   " S c i u s c i a   t u n e " 
 
 	 S l o t M o t o r     =   S l o t _ M 0 
 
 	 B u t t o n   1 2   C o l o r   F l a s h i n g 8   R e d   B l a c k 
 
 	 G o s u b   " E n a b l e   M o t o r s " 
 
 	 F o r   v 1   =   1   T o   1 0 0 
 
 	 	 S l o t ( S l o t M o t o r )   =   0 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 	 W a i t   S e c o n d s   0 . 3 
 
 	 	 
 
 	 	 S l o t ( S l o t M o t o r )   =   4 5 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 	 W a i t   S e c o n d s   0 . 3 
 
 	 N e x t 
 
 	 B u t t o n   1 2   C o l o r   A q u a m a r i n e 
 
 R e t u r n 
 
 
 
 L a b e l   " U P D A T E   F I L E " 
 
 	 v 1   =   S l o t ( S l o t _ M 0 ) 
 
 	 v 2   =   S l o t ( S l o t _ C o u n t e r R e a d e r O u t M 0 ) 
 
 	 v 3   =   v 1   -   v 2 
 
 	 S 3   =   N o w 
 
 	 s 3   =   S 3   +   "     "   +   F o r m a t ( N u m C y c l e s ,   " 0 0 0 0 0 " ) 
 
 	 s 3   =   s 3   +   "       "   +   F o r m a t ( v 1 ,   " 0 0 0 0 0 " ) 
 
 	 s 3   =   s 3   +   "       "   +   F o r m a t ( v 2 ,   " 0 0 0 0 0 " ) 
 
 	 s 3   =   S 3   +   "       "   +   F o r m a t ( v 3 ,   " 0 0 0 0 0 " ) 
 
 	 S a v e   S t r i n g T o F i l e   s 3   F i l e N a m e 
 
 	 ' P r i n t   s 3 
 
 R e t u r n 
 
 
 
 L a b e l   S a v e V a r s 
 
 	 v 1   =   N u m C y c l e s 
 
 	 v 2   =   E r r o r N u m b e r 
 
 	 S a v e   V a r s 
 
 R e t u r n 
 
 
 
 L a b e l   L o a d V a r s 
 
 	 L o a d   V a r s 
 
 	 N u m C y c l e s   =   v 1 
 
 	 E r r o r N u m b e r   =   v 2 
 
 R e t u r n 
 
 
 
 L a b e l   " E n a b l e   M o t o r s " 
 
 	 S l o t   S l o t _ E n a b l e M o t o r s   =   1 0 0 0   	 	 ' E n a b l e   M o t o r s 
 
 R e t u r n 
 
 
 
 L a b e l   " D i s a b l e   M o t o r s " 
 
 	 S l o t   S l o t _ E n a b l e M o t o r s   =   0   	                 ' D i s a b l e   M o t o r s 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = =   H O M E   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   H o m e 
 
 	 G o s u b   " E n a b l e   M o t o r s " 
 
 	 G o s u b   " H o m i n g _ M 2   Z " 
 
 	 G o s u b   " H o m i n g _ M 0 " 
 
 	 G o s u b   " H o m i n g _ M 1 " 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     H O M I N G   M 0   M 1   M 2 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   " H o m i n g _ M 0 " 
 
 	 G o s u b   " E n a b l e   M o t o r s " 
 
 	 S l o t M o t o r   =   S l o t _ M 0 
 
 	 S l o t S e n s o r   =   S l o t _ S e n s o r M 0 
 
 	 S l o t C o u n t e r R e a d e r R e s e t   =   S l o t _ C o u n t e r R e a d e r R e s e t M 0 
 
 	 S p e e d S e a r c h   =   - 0 . 1     	 '   s e a r c h   d i r e c t i o n   a n d   s p e e d 
 
 	 S p e e d R e t u r n   =   + 0 . 0 1 	         '   r e t u r n   d i r e c t i o n   a n d   s p e e d 
 
 	 D e c l a r e d Z e r o   =   9 0 	 	 '   d e c l a r e d   s w i t c h   a n g l e 
 
 	 I n i t i a l P o s i t i o n   =   1 8 0 	 '   m o v e   t o   t h i s   a n g l e 
 
 	 G o s u b   H o m e M o t o r 
 
 	 ' G o s u b   P r i n t V a l u e s 
 
 	 B u t t o n   2   C o l o r   S k y B l u e 
 
 R e t u r n 
 
 
 
 L a b e l   " H o m i n g _ M 1 " 
 
 	 G o s u b   " E n a b l e   M o t o r s " 
 
 	 S l o t M o t o r   =   S l o t _ M 1 
 
 	 S l o t S e n s o r   =   S l o t _ S e n s o r M 1 
 
 	 S l o t C o u n t e r R e a d e r R e s e t   =   S l o t _ C o u n t e r R e a d e r R e s e t M 1 
 
 	 S p e e d S e a r c h   =   - 0 . 1 	 	 '   0 . 0 6   s e a r c h   d i r e c t i o n   a n d   s p e e d 
 
 	 S p e e d R e t u r n   =   + 0 . 0 1 5 	 '   r e t u r n   d i r e c t i o n   a n d   s p e e d 
 
 	 D e c l a r e d Z e r o   =   9 0 	 	 '   3 3 . 3   d e c l a r e d   s w i t c h   a n g l e 
 
 	 I n i t i a l P o s i t i o n   =   1 8 0 	 '   m o v e   t o   t h i s   a n g l e 
 
 	 G o s u b   H o m e M o t o r 
 
 	 ' G o s u b   P r i n t V a l u e s 
 
 	 B u t t o n   3   C o l o r   S k y B l u e 
 
 R e t u r n 
 
 
 
 L a b e l   " H o m i n g _ M 2   Z " 
 
 	 G o s u b   " E n a b l e   M o t o r s " 
 
 	 S l o t M o t o r   =   S l o t _ M 2 
 
 	 S l o t S e n s o r   =   S l o t _ S e n s o r M 2 
 
 	 S l o t C o u n t e r R e a d e r R e s e t   =   S l o t _ C o u n t e r R e a d e r R e s e t M 2 
 
 	 S p e e d S e a r c h   =   + 0 . 0 4 	 	 '   s e a r c h   d i r e c t i o n   a n d   s p e e d 
 
 	 S p e e d R e t u r n   =   - 0 . 0 2 	 	 '   r e t u r n   d i r e c t i o n   a n d   s p e e d 
 
 	 D e c l a r e d Z e r o   =   1 9 2 	 	 '   d e c l a r e d   s w i t c h   a n g l e 
 
 	 I n i t i a l P o s i t i o n   =   1 9 0 	 '   m o v e   t o   t h i s   a n g l e 
 
 	 G o s u b   H o m e M o t o r 
 
 	 ' G o s u b   P r i n t V a l u e s 
 
 	 B u t t o n   4   C o l o r   S k y B l u e 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     H o m e   t h e   M o t o r ( S l o t M o t o r )   t o   t h e   S e n s o r ( S l o t S e n s o r ) 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   S l o t M o t o r 
 
 V a r i a b l e   N u m e r i c   S l o t S e n s o r 
 
 V a r i a b l e   N u m e r i c   S l o t C o u n t e r R e a d e r R e s e t 
 
 V a r i a b l e   N u m e r i c   S p e e d S e a r c h 
 
 V a r i a b l e   N u m e r i c   S p e e d R e t u r n 
 
 V a r i a b l e   N u m e r i c   D e c l a r e d Z e r o 
 
 V a r i a b l e   N u m e r i c   I n i t i a l P o s i t i o n 
 
 
 
 L a b e l   H o m e M o t o r 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - -   d e t a c h   i f   s e n s o r   i s   a c t i v e 
 
 	 I f   S l o t ( S l o t S e n s o r )   >   5 0 0   O r   K e y ( " C T R L " ) 
 
 	 	 S l o t ( S l o t M o t o r )   =   S l o t ( S l o t M o t o r )   +   S p e e d R e t u r n 
 
 	 E n d I f 
 
         '   - - - - - - - - - - - - - - - - - - - - - - - - -   s e a r c h   t h e   s e n s o r 
 
 L a b e l   S e a r c h H o m e 
 
 	 S l o t ( S l o t M o t o r )   =   S l o t ( S l o t M o t o r )   +   S p e e d S e a r c h 
 
 	 W a i t   S e c o n d s   0 . 0 0 1 
 
 	 I f   S l o t ( S l o t S e n s o r )   >   5 0 0   O r   K e y ( " C T R L " ) 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 	 G o t o   D e t a c h S e n s o r 
 
 	 E n d I f 
 
 G o t o   S e a r c h H o m e 
 
         '   - - - - - - - - - - - - - - - - - - - - - - - - -   d e t a c h   f r o m   t h e   s e n s o r 
 
 L a b e l   D e t a c h S e n s o r 
 
 	 S l o t ( S l o t M o t o r )   =   S l o t ( S l o t M o t o r )   +   S p e e d R e t u r n 
 
 	 W a i t   S e c o n d s   0 . 0 0 1 
 
 	 I f   S l o t   ( S l o t S e n s o r )   <   5 0 0 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 	 G o t o   A s s i g n Z e r o 
 
 	 E n d I f 
 
 G o t o   D e t a c h S e n s o r 
 
         '   - - - - - - - - - - - - - - - - - - - - - - - - -   r e s e t   a n d   m o v e   t o   I n i t i a l P o s 
 
 L a b e l   A s s i g n Z e r o 
 
 	 S l o t ( S l o t M o t o r )   =   R e s e t 
 
 	 S l o t ( S l o t C o u n t e r R e a d e r R e s e t )   =   R e s e t 
 
 	 W a i t   S e c o n d s   0 . 0 8 
 
 	 S l o t ( S l o t M o t o r )   =   D e c l a r e d Z e r o 
 
 	 S l o t ( S l o t C o u n t e r R e a d e r R e s e t )   =   D e c l a r e d Z e r o 
 
 	 G o s u b   W a i t M o t o r 
 
 	 S l o t ( S l o t M o t o r )   =   I n i t i a l P o s i t i o n 
 
 	 S l o t ( S l o t C o u n t e r R e a d e r R e s e t )   =   I n i t i a l P o s i t i o n 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '       W a i t   u n t i l   t h e   m o t o r ( S l o t M o t o r )   i s   s t o p p e d 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   W a i t M o t 1 
 
 L a b e l   W a i t M o t o r 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 F o r   W a i t M o t 1   =   1   T o   9 e 9 9 
 
 	 	 I f   A b s ( S l o t ( S l o t M o t o r   +   1 ) )   <   0 . 0 1 
 
 	 	 	 R e t u r n 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 0 0 5 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   W a i t M o t o r A n d R e c o v e r y 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 F o r   W a i t M o t 1   =   1   T o   9 e 9 9 
 
 	 	 I f   A b s ( S l o t ( S l o t M o t o r   +   1 ) )   <   0 . 0 1 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 0 0 5 
 
 	 N e x t 
 
 	 W a i t   S e c o n d s   0 . 2 
 
 	 I f   A b s ( S l o t ( S l o t M o t o r )   -   S l o t ( S l o t C o u n t e r R e a d e r O u t ) )   > =   T o l e r a n c e 
 
 	 	 G o s u b   " E r r o r R e c o v e r y " 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     L E D   C O L O R S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   " R e d " 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   " G r e e n " 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   " B l u " 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   " W h i t e " 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   " Y e l l o w " 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   9 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   " N O C O L O R " 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 ' - - - - -   C L O S I N G   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 
 
 L a b e l   " C L O S E   A L L " 
 
 	 L o a d   C l o s e A p p s 
 
 R e t u r n 
 
 
 
 L a b e l   " E v e n t S t o p " 
 
 	 S a v e   V a r s 
 
 	 G o s u b   " D i s a b l e   M o t o r s " 
 
 	 W i n d o w   S i z a b l e 
 
 E n d 
 
 
 
 
 
 ' = = = = = =   D U M M Y   A R E A   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 ' = = = = = =   T O   D O   A R E A   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 ' W A T C H   S e q u e n c e C m d 
 
 ' W A T C H   s 1 
 
 ' W A T C H   U C a s e ( S e q u e n c e C m d ) 
 
 